<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增文件')" />
	<th:block th:include="include :: bootstrap-fileinput-css" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-fileMsg-add"  enctype="multipart/form-data">
			<input id="id" name="id" type="hidden" th:value="${fileMsg.id}">
			<input id="parentId" name="parentId" type="hidden" th:value="${fileMsg.parentId}">
			<input id="fRepoId" name="fRepoId" type="hidden" th:value="${fileMsg.fRepoId}">
			<div class="form-group">
				<div class="col-sm-12">
					<div class="file-loading">
						<input id="fileOrD" name="fileOrD" type="file" class="file" data-browse-on-zone-click="true">
					</div>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: bootstrap-fileinput-js" />
	<script th:inline="javascript">
        var prefix = ctx + "busi/file/msg";

		$("#form-fileMsg-add").fileinput({'showUpload':false, 'previewFileType':'any'});

		function submitHandler() {
			if ($.validate.form()) {
				var config = {
					url: prefix + "/addFileOrZipDirectory",
					type: "post",
					data: new FormData(document.getElementById("form-fileMsg-add")),
					processData: false,                // jQuery不要去处理发送的数据
					contentType: false,
					beforeSend: function () {
						$.modal.loading("正在处理中，请稍候...");
						$.modal.disable();
					},
					success: function(result) {
						if (typeof callback == "function") {
							callback(result);
						}
						$.operate.successCallback(result);
					}
				};
				$.ajax(config);
			}
		}
    </script>
</body>
</html>
